export function newArr(arr) {
  const obj = {}
  arr.forEach(item => {
    if (!item.children) {
      item.children = []
    }
    obj[item.id] = item
  })
  // console.log(obj);
  const arr2 = []
  arr.forEach(item => {
    const prom = obj[item.pid]
    if (prom) {
      prom.children.push(item)
    } else {
      arr2.push(item)
    }
  })
  return arr2
}
